home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / FileDialog.h < prev    next >
C/C++ Source or Header  |  1992-06-09  |  2KB  |  115 lines

  1. #ifndef FileDialog_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define FileDialog_First
  7.  
  8. #include "Dialog.h"
  9.  
  10. class TextField;
  11. class TextItem;
  12. class CollectionView;
  13. class OrdCollection;
  14. class Menu;
  15. class PopupButton;
  16. class ImageItem;
  17. class TextItem;
  18. class ActionButton;
  19. class Scroller;
  20. class Data;
  21.  
  22. //---- FileDialog --------------------------------------------------------------
  23.  
  24. const int cMaxPathName= 400;
  25.  
  26. typedef bool (EvtHandler::*FilterFunc)(Data *d);
  27.  
  28. //---- id's 
  29.  
  30. const int cIdName       =   cIdFirstUser + 110,
  31.       cIdList       =   cIdFirstUser + 111,
  32.       cIdUpdate     =   cIdFirstUser + 112,
  33.       cIdPath       =   cIdFirstUser + 113,
  34.       cIdComponent  =   cIdFirstUser + 120;
  35.  
  36. const int cPathBuf      =   200,
  37.       cItemMinWidth =   250,
  38.       cNumItems     =   7;
  39.  
  40. enum FileDialogFlags {
  41.     eFDRead,
  42.     eFDWrite,
  43.     eFDImport
  44. };
  45.  
  46. class FileDialog : public Dialog {
  47. public:
  48.     MetaDef(FileDialog);
  49.     
  50.     FileDialog(char *title= "File Dialog");
  51.     ~FileDialog();
  52.     
  53.     int ShowInWindow(FileDialogFlags, Clipper*, EvtHandler *eh= 0, char *msg= 0);
  54.     char *FileName();
  55.     Data *GetFileData()
  56.     { return fileData; }
  57.     Data *GetData()
  58.     { return fileData; }
  59.     virtual bool WrongType();
  60.     virtual bool ChangeDirectory();
  61.  
  62. protected:
  63.     void InputKbd(Token &t);
  64.     VObject *DoMakeContent();
  65.     void DoSetup();
  66.     void DoRestore();
  67.     void DoSetDefaults();
  68.     void Control(int id, int, void *v);
  69.     int ItemHeight();
  70.     virtual void UpdateList();
  71.     virtual void UpdatePath();
  72.     virtual bool OpenOrChangeDir();
  73.     virtual VObject *MakeFileItem(Data *d);
  74.  
  75. protected:
  76.     TextField *eti;
  77.     TextItem *title;
  78.     char *initDir;
  79.     FileDialogFlags flags;
  80.     CollectionView *collview;
  81.     OrdCollection *pathList;
  82.     EvtHandler *doc;
  83.     Data *fileData;
  84.     ActionButton *openButton;
  85.     PopupButton *pathPopup;
  86.     FilterFunc filterfunc;
  87.     Scroller *scroller;
  88.     Data *current;
  89. };
  90.  
  91. //---- FileItem --------------------------------------------------------------
  92.  
  93. class FileItem: public VObject {
  94. protected:
  95.     Data *data;
  96.  
  97. public:
  98.     MetaDef(FileItem);
  99.     FileItem(char *name, bool shallow= TRUE);
  100.     FileItem(Data *d);
  101.     ~FileItem();
  102.     
  103.     Data *GetData()
  104.     { return data; }
  105.     char *AsString();
  106.     int Compare(Object *op);
  107.     void Draw(Rectangle r);
  108.     Metric GetMinSize();
  109. };
  110.  
  111. extern const Point cIconSize;
  112.         
  113. #endif
  114.  
  115.